package com.pet.shop.service.shop;

import com.pet.exceptions.BusinessException;
import com.pet.shop.dto.PageDto;
import com.pet.shop.entity.shop.AdvertInfo;
import com.pet.shop.entity.user.UserInfo;
import com.pet.shop.mappers.shop.AdvertInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.List;
import java.util.Map;

/**
 * Created by carry.zhou on 2018-5-7.
 */
@Service
public class AdvertInfoServiceImpl implements IAdvertInfoService {

    @Autowired
    private AdvertInfoMapper advertInfoMapper;

    @Override
    public int deleteEntity(Long id) {
        return advertInfoMapper.delete(id);
    }

    @Override
    public int deleteEntityList(List<Long> idList) {
        if(idList == null || idList.isEmpty()) return 0;
        int i = 0;
        for (Long id : idList) {
            i += advertInfoMapper.delete(id);
        }
        return i;
    }

    @Override
    public AdvertInfo insertEntity(AdvertInfo record) {

        return record;
    }

    @Override
    public AdvertInfo getEntity(Long id) {
        return advertInfoMapper.get(id);
    }

    @Override
    public int updateEntity(AdvertInfo record) {
        return advertInfoMapper.update(record);
    }

    @Override
    public PageDto<AdvertInfo> queryPage(PageDto<AdvertInfo> pageDto) {
        return null;
    }
    @Override
    public List<AdvertInfo> queryAdvertInfo(Map<String,Object> map){
        return advertInfoMapper.queryAdvertInfo(map);
    }
}
